<%@ page contentType="text/html;charset=UTF-8" %> 
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
   
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
    
    <script type="text/javascript">

    
	    //保存方法
	    var saveDict={
	         t:null,
	         save:function(t){
	              $(t).attr("disabled",true);
	              this.t=t;
	              // 表单验证
	              $("#inputForm").validate({
	                   // 重名验证
	                   rules: {
	                    itemCode: {remote: "${ctx}/database/message/checkName"}
	                   },
	                   messages: {
	                    //数据值以存在
	                    itemCode: {remote: '<spring:message code="data_code_have_exits"/>'}
	                   },
	                   fail: function(element,e) {  
	                        $(saveDict.t).attr("disabled",false);
	                   },
	                   submitHandler: function() {
	                	// 格式化，去除逗号
	                         formUnFormat($("#inputForm"));
	                	    var params = $("#inputForm").serialize();
	                	    var itemCode = $("#itemCode").val();
	            	    	var itemNameCn = $("#itemNameCn").val();
	            	    	var itemNameEn = $("#itemNameEn").val();
	            	    	var itemNameJp = $("#itemNameJp").val();
	            	    	var remarks = $("#remarks").val();
	            	    	var id = $("#id").val();
	            	    	
	                	    // 调用后台删除方法
	            	        $.post("${ctx}/database/message/save?itemCode="+$("#itemCode").val() +"&itemNameCn=" + itemNameCn +"&itemNameEn=" + itemNameEn
	            	        		+"&itemNameJp=" + itemNameJp +"&remarks=" + remarks+"&id=" + id, "",function(result) {
	            	             // 提示信息
	            	             tipParent(result.message);
	            	             // 返回状态
	            	            if(result.statusCode==STATUSCODEOK){
	            	            	// 刷新页面
	                                window.parent.frames[0].searchListForm();
	            	                 // 关闭页面
	            	                closeWin(); 
	            	             }
	            	        },'json');
	                   }
	              });
	              // 提交表单
	              $("#inputForm").submit(); 
	         } 
	    }
	    
	 
	    
	    //删除方法
	    function delDict(){
	          // 调用后台删除方法
	        $.post("${ctx}/customer/brand/delete?id=${brand.id}&&oldItemValue=${dict.oldItemValue}",'',function(result){
	             // 提示信息
	             tipParent(result.message);
	             // 返回状态
	            if(result.statusCode==STATUSCODEOK){
	                 // 刷新页面
	                window.parent.frames[0].location.reload();
	                 // 关闭页面
	                closeWin(); 
	             }
	        },'json');
	   }
	    
    // 新建子项
    function createSubItem(delIndex) {
    
           
        // 项目值不能为空
        if ($('#itemCode').val() != "") {

        	   popup('800px','519px','${ctx}/database/message/formSub?itemCode=' + $('#itemCode').val()+"&delIndex="+delIndex);

        } else {

             // 请输入合法项目值！
             layer.msg('<spring:message code="data_code_cannot_empty"/>', {time:1000});

        }
     
    }
    
    //选择添加子项目
    function addItemValue(){
        // 调用后台查询子项list
        $.post("${ctx}/database/message/searchSubList", "", function(result) {
            // 回调函数赋值
            var h = $(callBackHtml(result)).find("#itemSub").html();
            $('#itemSub').html(h);
        }, 'html');
    }
    </script>
    
</head>
<body>   
<form id="inputForm" method="post">
<!-- 创建编辑头部 -->

	<!-- 创建页面head部 -->
	<div id="editPage" class="layerHeader clearfix">
    	<p class="headerTitle"><spring:message code="dict_readAccount"/></p>
			<div class="headerButton clearfix">
	        <!-- 编辑 -->
	        <shiro:hasPermission name="customer:brand:edit">
	        <button type="button" onClick="window.location.href='${ctx}/customer/brand/form?id=${brand.id}'" >
	               <spring:message code="dict_edit" />
	        </button>
	        
            <!-- 删除 -->
            <button type="button" onclick="del(delDict)"><spring:message code="btn_delete"/></button>
            </shiro:hasPermission>
            <!-- 取消 -->
            <button type="button" onclick="closeWin()"><spring:message code="btn_cancle"/></button>          
	    </div>
	</div>
<!-- 入力框 -->

<div id="showHtml" class="tabBoxSm" >
	<div class="smList">
	        <div class="items clearfix" >
	        	<div class="col-50 clearfix haveToBox" >
	        		  <!--  品牌名称： -->
	                <p class="tit"><spring:message code="brand_name" /></p>
	                <p>${dictList[0].brandCn}</p>
	            </div>            
	        </div>

	        <div class="items clearfix">
	        	<div class="col-50 clearfix haveToBox">
	        		 <!--  品牌英文名称-->
	                <p class="tit"><spring:message code="brand_english_name" /></p>
	                <p>${dictList[0].brandEn}</p>
	               
	            </div>
	        </div>

	<div class="items clearfix">
			<div class="col-50 clearfix">
				<!-- 状态 -->
				<p class="tit"><spring:message code="dict_state_show"/></p>
				<p class="rtname fl">
				<c:choose>
					<c:when test="${brand.enableFlag eq 1}"><spring:message code="dict_enable"/></c:when>
				</c:choose>
				<c:choose>
					<c:when test="${brand.enableFlag eq 0}"><spring:message code="dict_disable"/></c:when>
				</c:choose>
				</p>
			</div>
		</div>

	
<!-- 	        <div class="items clearfix"> -->
<!-- 	        	<div class="col-50 clearfix"> -->
<!-- 	        		状态 -->
<%-- 					<p class="tit"><spring:message code="dict_state" /></p> --%>
<!-- 					<div class="labelBox"> -->
<!-- 						启用 -->
<!-- 						<label> <input type="radio" name="enableFlag" -->
<!-- 							checked='checked' value="1" -->
<%-- 							<c:if test="${dict.enableFlag eq 1}">checked="checked"</c:if> --%>
<%-- 							class="rast" /> <spring:message code="dict_enable" />  --%>
<!-- 						</label> -->
<!-- 						停用 -->
<!-- 						<label><input type="radio" name="enableFlag" value="0" -->
<%-- 							<c:if test="${dict.enableFlag eq 0}">checked="checked"</c:if> --%>
<%-- 							class="rast" /> <spring:message code="dict_disable" />  --%>
<!-- 						</label> -->
<!-- 					</div> -->
<!-- 	            </div> -->
<!-- 	        </div> -->
	        <div class="items clearfix">
		       <!-- 描述 -->
               <p class="tit"><spring:message code="describe_remark"/></span></p>
               <p>${dictList[0].remarks}</p>
		    </div> 
	</div>
</div>
</form>
<script>
</script>
</body>
</html>
